home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcb100t.arc / CTDEMO.C < prev    next >
Text File  |  1988-03-05  |  31KB  |  1,048 lines

  1.  
  2. /*                             CTDEMO.C
  3.  *
  4.  *
  5.  *   This is a simple demo program to test some of the C Tool Box
  6.  *   functions.  Current plans call for further expansion of the library.
  7.  *   The final library developed will hopefully include data entry
  8.  *   forms and menus built around windows.  It is hoped to provide
  9.  *   full data editing and verification with the window forms.
  10.  *
  11.  *   This version requires the use of a color graphics adapter if you
  12.  *   beyond the window portion of the program.
  13.  *
  14.  *
  15.  *   This program and its supporting code (with the exception of the
  16.  *   Unicorn Library) are placed in the public domain by the author.
  17.  *   You have full rights to use this code in any manner you may see
  18.  *   fit with the exception of using any or all for profit.  A club
  19.  *   or users group may however charge a small handling fee not to
  20.  *   exceed $7.00.  The author retains all rights to the Library
  21.  *   subject to the shareware notice contained with the documentation for
  22.  *   that library.
  23.  *
  24.  *   This will be released under the shareware concept as was the previous
  25.  *   Unicorn library.
  26.  *
  27.  *
  28.  *                            David A. Miller
  29.  *                            Unicorn Software
  30.  *                            8018 NE 123rd St
  31.  *                            Kirkland, WA 98034
  32.  *                            (206) 823-4656 after 6PM PST
  33.  *                            Please, no collect calls
  34.  *
  35.  *    Release date 22 August 1987
  36.  */
  37.  
  38. #include <alloc.h>
  39. #include <stdio.h>
  40. #include <windows.h>
  41. #include <ctb.h>
  42. #include <border.h>
  43. #include <bdrdef.h>
  44. #include <colors.h>
  45.  
  46.  
  47. extern ct_mode_;    /* These are global variables where the current video  */
  48. extern ct_col_;     /* mode and number of screen columns are stored        */
  49. extern v_start;
  50.  
  51. BOX *title, *first, *second, *third, *fourth, *fifth, *sixth, *small;
  52. BOX *mine;
  53.  
  54.  
  55.  
  56. /*  The user is allowed up to 249 notes for background music.  The last
  57.  *  note (the 250th if all are used) MUST be 0xff or the function will
  58.  *  not terminate properly.
  59.  */
  60.                                 /* Short segment for test purposes */
  61. /*
  62. int melody[250] = {26, 29, 31, 33, 0xff};
  63. int beat[250]   = { 6, 12,  6,  7, 1};
  64. */
  65.  
  66.                         /* The below defines notes for Greensleeves */
  67.  
  68. int melody[250] = {26, 29, 31, 33, 35, 33, 31, 28, 24, 26, 28, 29, 26,100,
  69.                    26, 25, 26, 28, 25, 21, 26, 29, 31, 33, 35, 33, 31,
  70.                    28, 24, 26, 28, 29, 28, 26, 25, 23, 25, 26,100, 26, 36,
  71.                   100, 36, 35, 33, 31, 28, 24, 26, 28, 29, 26,100, 26, 25, 26,
  72.                    28, 25, 21, 36,100, 36, 35, 33, 31, 28, 24, 26, 28, 29,
  73.                    28, 26, 25, 23, 25, 26,100, 26, 0xff};
  74.  
  75. int beat[250] =   { 6, 12,  6,  7,  4,  6, 12,  6,  7,  4,  6, 12,  6,  1,
  76.                     7,  4,  6, 12,  6, 12,  6, 12,  6,  7,  4,  6, 12,
  77.                     6,  7,  4,  6,  7,  4,  7,  4,  6,  6, 18,  1, 18, 12,
  78.                     1,  6,  6,  6, 12,  6,  7,  4,  6, 12,  6,  1,  7,  4,  6,
  79.                    12,  6, 20, 20,  1,  7,  4,  6, 12,  6,  7,  4,  6,  7,
  80.                     4,  6,  6,  6,  6, 20,  1, 16,  1};
  81.  
  82.  
  83.  
  84. int start = 9;
  85.  
  86.  
  87. main()
  88. {
  89.    char a[80], *wgets(), ch, name[60];
  90.    int  i, j, w, h, row, col;
  91.    unsigned *p, *mem;
  92.  
  93.    sm(3);
  94.    ctinit();
  95.  
  96. /*  makebox sets up the definition of a box by allocating memory for a box
  97.  *  structure and placing data into it.  The form is
  98.  *  makebox(row, col, height, width, bfore, bback, ffore, fback);
  99.  *
  100.  *  savebox copies the screen area under the box and stores a pointer to
  101.  *  that memory in the box structure.
  102.  *
  103.  *  draw box actually draws the box on the screen using direct video memory
  104.  *  writes for speed.
  105.  *
  106.  *  boxtitle places a title in the border area of the box.  The form is
  107.  *  boxtitle(BoxPointer, 0/1, " Title ", fore, back);
  108.  *
  109.  */
  110.  
  111.  
  112.    first = makebox(0,0,23,79,14, 4, 14, 1);
  113.    savebox(first);
  114.    drawbox(first);
  115.    boxtitle(first, 0, 72, " Box 1 " , YELLOW, 99);
  116.  
  117.  
  118.    ct_wvstr(6, 68, LTWHITE, 99, "Vertical Strings", first);
  119.    ct_wvstr(6, 72, LTWHITE, 99, "are possible    ", first);
  120.  
  121.  
  122.  
  123.    ct_str( 8, 10,  4, 1, "        ▄▄▄▄▄▄                                      ");
  124.    ct_str( 9, 10,  4, 1, "        █████▄                                      ");
  125.    ct_str(10, 10, 11, 1, "        │                                           ");
  126.    ct_str(11, 10, 11, 1, "        │                                           ");
  127.    ct_str(12, 10,  7, 1, "██  ██  ██                              ██  ██  ██  ");
  128.    ct_str(13, 10,  7, 1, " ████████                                ████████   ");
  129.    ct_str(14, 10,  7, 1, " ████  ██   ██  ██  ██  ██  ██  ██  ██   ███  ███   ");
  130.    ct_str(15, 10,  7, 1, " ████████████████████████████████████████████████   ");
  131.    ct_str(16, 10,  7, 1, " █████████  ███████████████  ██████████  ████████   ");
  132.    ct_str(17, 10,  7, 1, " ██████████████████░░░░░░████████████████████████   ");
  133.    ct_str(18, 10,  7, 1, " ██████████████████░░░░░░████████████████████████   ");
  134.    ct_str(19, 10,  7, 1, " ██████████████████░░░░░░████████████████████████   ");
  135.    ct_str(20, 10,  7, 1, " ██████████████████░░░░░░████████████████████████   ");
  136.    ct_str(21, 5, GREEN, 1, "██████████████████████████████████████████████████████████████");
  137.    ct_str(22, 5, GREEN, 1, "██████████████████████████████████████████████████████████████");
  138.  
  139.    if (ct_mode_ != 7)
  140.    {
  141.       ct_str(14, 15, 14, 1, "██");
  142.       ct_str(16, 37, 14, 1, "██");
  143.  
  144.       ct_str(8,  18,  4, 1, "▄▄▄▄▄");
  145.       ct_str(9,  18, 11, 4, " CTB ");
  146.       ct_str(8,  18,  7, 4, "▀");
  147.  
  148.       ct_str(17, 29,  8, 6, "░░░░░░");
  149.       ct_str(18, 29,  8, 6, "░░░░░░");
  150.       ct_str(19, 29,  8, 6, "░░░░░░");
  151.       ct_str(20, 29,  8, 6, "░░░░░░");
  152.    }
  153.  
  154.    title = makebox(1, 25, 2, 27, 14, 1, 14, 1);
  155.    makebdr(title, space);
  156.    savebox(title);
  157.    drawbox(title);
  158.    ct_wstr(1,5,99,99, "Unicorn Software ", title);
  159.  
  160.  
  161.    second = makebox(3, 25, 4, 26, 9, 1, 9, 1);
  162.    makebdr(second, space);
  163.    savebox(second);
  164.    drawbox(second);
  165.    ct_wstr(1,9,99,99, "Presents", second);
  166.    ct_wstr(2,6,15 + BLINK, 99, "The C Tool Box", second);
  167.  
  168.    for(i = 0; i <= 10000; i++)
  169.      for(j = 0; j <= 30; j++)
  170.           ;
  171.  
  172.    third = makebox(12, 10, 4, 59, 9,6,9,6);
  173.    makebdr(third, bdr1);
  174.    savebox(third);
  175.    drawbox(third);
  176.    boxtitle(third, 1, 2, " Box 3 ", 98, 98);
  177.  
  178.    ct_wstr(1,15,99,99, "What is your name?", third);
  179.    setcurps(0, 13, 45);
  180.    gets(name);
  181.    ct_wstr(2,15,99,99,"Hello ", third);
  182.    ct_wstr(2,22,99,99, name, third);
  183.    ct_wstr(3,5,99,99, "Would you be so kind as to press my enter key?", third);
  184.    setcurps(0, 15, 67);
  185.    gets(a);
  186.  
  187.    
  188.    fourth = makebox(18, 10, 3, 59, 7,4,7, 4);
  189.    makebdr(fourth, bdr21);
  190.    savebox(fourth);
  191.    drawbox(fourth);
  192.    boxtitle(fourth, 0, 10, " Fourth Box ", 99, 99);
  193.  
  194.    ct_wstr(1,5,99,99, "Thank you ", fourth);
  195.    ct_wstr(1,16,99,99, name, fourth);
  196.    ct_wstr(2, 5, 99,99, "Now if you would press it again please", fourth);
  197.  
  198.    setcurps(0, 20, 57);
  199.    gets(a);
  200.  
  201.  
  202.    fifth = makebox(6,10, 13, 59, LTMAGENTA, 5, 9, 5);
  203.    makebdr(fifth, bdr12);
  204.    savebox(fifth);
  205.    drawbox(fifth);
  206.    boxtitle(fifth, 0, 10, "« Fifth Box »", 99, 99);
  207.  
  208.    ct_wstr(1,3,99,99," Unicorn Software is happy to provide this tool box of", fifth);
  209.    ct_wstr(2,3,99,99,"functions in the form of shareware.  The library may  ", fifth);
  210.    ct_wstr(3,3,99,99,"be registered with the author.  Upon registration you ", fifth);
  211.    ct_wstr(4,3,99,99,"will be sent the complete manual on disk and full     ", fifth);
  212.    ct_wstr(5,3,99,99,"source code to the library.  The manual runs well over", fifth);
  213.    ct_wstr(6,3,99,99,"200 pages.  If you wish, a preprinted manual is also  ", fifth);
  214.    ct_wstr(7,3,99,99,"available.                                            ", fifth);
  215.  
  216.    ct_wstr(9, 3,YELLOW,99,   "                David A.  Miller                     ", fifth);
  217.    ct_wstr(10,3,WHITE,99,    "                Unicorn Software                     ", fifth);
  218.    ct_wstr(11,3,LTMAGENTA,99,"     8018 NE 123rd St.  Kirkland, WA  98034          ", fifth);
  219.  
  220.  
  221.    gets(a);
  222.  
  223.  
  224.    sixth = makebox(5,5, 10, 59, 4, 3, 15, 3);
  225.    makebdr(sixth, bdr12);
  226.    savebox(sixth);
  227.    drawbox(sixth);
  228.    boxtitle(sixth, 0, 10, "« Sixth Box »", 99, 99);
  229.  
  230.    ct_wstr(1,3,99,99,"The tool box contains most of the previous Unicorn    ", sixth);
  231.    ct_wstr(2,3,99,99,"Library functions ( over 200) plus a fast window      ", sixth);
  232.    ct_wstr(3,3,99,99,"library, background sound and much more.  The entire  ", sixth);
  233.    ct_wstr(4,3,99,99,"library encompasses graphics, text handling, mouse and", sixth);
  234.    ct_wstr(5,3,99,99,"joystick control graphics and daisy wheel control     ", sixth);
  235.    ct_wstr(6,3,99,99,"functions, background sound functions and more.  An   ", sixth);
  236.    ct_wstr(7,3,99,99,"EGA version of the library should be released         ", sixth);
  237.    ct_wstr(8,3,99,99,"before the end of 1987.  <Press ENTER at each pause>  ", sixth);
  238.  
  239.    setcurps(0,0,0);
  240.    gets(a);
  241.    resbox(sixth);
  242.    gets(a);
  243.    resbox(fifth);
  244.    gets(a);
  245.    resbox(fourth);
  246.    gets(a);
  247.    resbox(third);
  248.    gets(a);
  249.    resbox(second);
  250.    gets(a);
  251.    resbox(first);
  252.  
  253.  
  254.    back16_8(12, 14);   /* Switch to using highlighted background colors */
  255.  
  256.    printf("\tMode is %d and columns are %d and start is %X Hex\n", ct_mode_, ct_col_, v_start);
  257.    if (gcomtype() == 0xff)
  258.       printf("\tThis computer is a PC or very close compatible\n\n");
  259.    if (gcomtype() == 0xfc)
  260.       printf("\tThis computer is an AT or very close compatible\n\n");
  261.    if (gcomtype() == 0xfe)
  262.       printf("\tThis computer is an XT or very close compatible\n\n");
  263.    if (gcomtype() == 0xfd)
  264.       printf("\tThis computer is an PCjr or very close compatible\n\n");
  265.    if (gcomtype() == 0xf9)
  266.       printf("\tThis computer is an PC convertible or very close compatible\n\n");
  267.  
  268.    printf("\tNote that it is possible to use the highlighted colors in the\n");
  269.    printf("\ttext mode for background color if you give up the blinking \n");
  270.    printf("\ttext attribute.  Functions are available to switch between\n");
  271.    printf("\tblink and high-intensity background modes.  If you wish to\n");
  272.    printf("\tgo further in this demo you MUST have a graphics adapter\n");
  273.    printf("\tinstalled.  Please be aware also that music will be played\n");
  274.    printf("\tin the background mode while other things occur on screen.\n");
  275.    printf("\tWhile this is similar to BASIC in some respects you have \n");
  276.    printf("\ta limit of 249 notes with this library, not the limit of \n");
  277.    printf("\t32 notes BASIC allows you.  Even this limit is user changable.\n");
  278.  
  279.  
  280.  
  281.    printf("\n\t\t\tPress any key to continue\n");
  282.    waitkey();
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.    /* Draw bar graphs next */
  290.  
  291.    sm(4);
  292.    palette(2, 5, 14);
  293.  
  294.    hollow('B', 5,  70, 3);
  295.    hollow('A', 5,  90, 3);
  296.    hollow('R', 5, 110, 3);
  297.    hollow('G', 5, 140, 3);
  298.    hollow('R', 5, 160, 3);
  299.    hollow('A', 5, 180, 3);
  300.    hollow('P', 5, 200, 3);
  301.    hollow('H', 5, 220, 3);
  302.  
  303.    vbar3d(150, 80, 100, 12, 16, 2, 3);
  304.    vbar3d(150, 100, 140, 8, 26, 2, 3);
  305.    vbar3d(150, 40, 180, 25, 8, 2, 3);
  306.  
  307.    usrfont('I', 153,  90, 1, 1, 2, 1);
  308.    usrfont('T', 153,  95, 1, 1, 2, 1);
  309.    usrfont('E', 153, 100, 1, 1, 2, 1);
  310.    usrfont('M', 153, 105, 1, 1, 2, 1);
  311.    usrfont('1', 153, 115, 1, 1, 2, 1);
  312.  
  313.    usrfont('I', 153, 135, 1, 1, 2, 1);
  314.    usrfont('T', 153, 140, 1, 1, 2, 1);
  315.    usrfont('E', 153, 145, 1, 1, 2, 1);
  316.    usrfont('M', 153, 150, 1, 1, 2, 1);
  317.    usrfont('2', 153, 160, 1, 1, 2, 1);
  318.  
  319.    usrfont('I', 153, 180, 1, 1, 2, 1);
  320.    usrfont('T', 153, 185, 1, 1, 2, 1);
  321.    usrfont('E', 153, 190, 1, 1, 2, 1);
  322.    usrfont('M', 153, 195, 1, 1, 2, 1);
  323.    usrfont('3', 153, 205, 1, 1, 2, 1);
  324.  
  325.    script('O', 158,  66, 1);
  326.    script('t', 158,  82, 1);
  327.    script('h', 158,  98, 1);
  328.    script('e', 158, 114, 1);
  329.    script('r', 158, 130, 1);
  330.    script('g', 158, 156, 1);
  331.    script('r', 158, 172, 1);
  332.    script('a', 158, 188, 1);
  333.    script('p', 158, 204, 1);
  334.    script('h', 158, 220, 1);
  335.  
  336.    usrfont('S', 189, 30,  1, 1, 1, 0);
  337.    usrfont('T', 189, 40,  1, 1, 1, 0);
  338.    usrfont('Y', 189, 50,  1, 1, 1, 0);
  339.    usrfont('L', 189, 60,  1, 1, 1, 0);
  340.    usrfont('E', 189, 70,  1, 1, 1, 0);
  341.    usrfont('S', 189,  80, 1, 1, 1, 0);
  342.    usrfont('W', 189, 100, 1, 1, 2, 0);
  343.    usrfont('I', 189, 110, 1, 1, 2, 0);
  344.    usrfont('L', 189, 120, 1, 1, 2, 0);
  345.    usrfont('L', 189, 130, 1, 1, 2, 0);
  346.    usrfont('B', 189, 150, 1, 1, 1, 0);
  347.    usrfont('E', 189, 160, 1, 1, 1, 0);
  348.    usrfont('A', 189, 180, 1, 1, 1, 0);
  349.    usrfont('V', 189, 190, 1, 1, 1, 0);
  350.    usrfont('A', 189, 200, 1, 1, 1, 0);
  351.    usrfont('I', 189, 210, 1, 1, 1, 0);
  352.    usrfont('L', 189, 220, 1, 1, 1, 0);
  353.    usrfont('A', 189, 230, 1, 1, 1, 0);
  354.    usrfont('B', 189, 240, 1, 1, 1, 0);
  355.    usrfont('L', 189, 250, 1, 1, 1, 0);
  356.    usrfont('E', 189, 260, 1, 1, 1, 0);
  357.    waitkey();
  358.  
  359.  
  360.  
  361.    sm(4);
  362.    backclr(1);
  363.  
  364.    gothic('U',10,start+0,3);
  365.    gothic('n',10,start+25,3);
  366.    gothic('i',10,start+45,3);
  367.    gothic('c',10,start+60,3);
  368.    gothic('o',10,start+80,3);
  369.    gothic('r',10,start+100,3);
  370.    gothic('n',10,start+120,3);
  371.  
  372.    gothic('S',10,start+150,3);
  373.    gothic('o',10,start+170,3);
  374.    gothic('f',10,start+190,3);
  375.    gothic('t',10,start+205,3);
  376.    gothic('w',10,start+220,3);
  377.    gothic('a',10,start+240,3);
  378.    gothic('r',10,start+260,3);
  379.    gothic('e',10,start+280,3);
  380.  
  381.    raschar('P', 50, start + 70, 2, 2, 3);
  382.    raschar('r', 50, start + 90, 2, 2, 3);
  383.    raschar('e', 50, start + 110, 2, 2, 3);
  384.    raschar('s', 50, start + 130, 2, 2, 3);
  385.    raschar('e', 50, start + 150, 2, 2, 3);
  386.    raschar('n', 50, start + 170, 2, 2, 3);
  387.    raschar('t', 50, start + 190, 2, 2, 3);
  388.    raschar('s', 50, start + 210, 2, 2, 3);
  389.  
  390.    setsound();   /* Play the greensleeves melody in the background */
  391.    
  392.    unicorn();
  393.    atsay(24, 3, 2, 0,"Copyright (c) 1986 David A. Miller");
  394.    cntue();
  395.    waitkey();
  396.    sm(4);       /* this resets the mode which in effect is a
  397.                    clear screen command.                      */
  398.    backclr(9);
  399.  
  400.    printf("\n\n A demonstration of IBM PC graphics\n");
  401.    printf(" using the 4 color med. resolution mode\n");
  402.    printf(" and the C Tool Box library of\n");
  403.    printf(" functions.\n");
  404.    printf(" This library is designed to work with \n");
  405.    printf(" the Turbo C small model. It has\n");
  406.    printf(" been written using Turbo C  1.0 \n");
  407.    printf(" and the Microsoft Assembler 4.0.\n");
  408.    printf("    Not all library functions are\n");
  409.    printf(" illustrated in this demo.  The\n");
  410.    printf(" library is capable of many graphics\n");
  411.    printf(" concepts including points, lines,\n");
  412.    printf(" circles, ellipses (these may be \n");
  413.    printf(" rotated from the vertical or\n");
  414.    printf(" horizontal) and colorful print\n");
  415.    printf(" including different fonts.  We\n");
  416.    printf(" hope you enjoy the C TOOL BOX\n");
  417.    printf(" Version 1.00 for Turbo C  ver 1.0\n");
  418.    printf(" small model.\n");
  419.    printf("  Copyright (C) 1986 David A. Miller\n");
  420.    atsay(23,8,2,0,"Press any key to continue");
  421.    waitkey();
  422.    sm(4);       /* this resets the mode which in effect is a
  423.                    clear screen command.                      */
  424.    backclr(14);
  425.  
  426.  
  427.  
  428.    pg1();
  429.    waitkey();
  430.    sm(4);
  431.    backclr(1);
  432.  
  433.  
  434.  
  435.    pg2();
  436.    cntue();
  437.    waitkey();
  438.    sm(4);
  439.    backclr(1);
  440.  
  441.    pg3();
  442.    cntue();
  443.    waitkey();
  444.    sm(4);
  445.    backclr(9);
  446.  
  447.    atom();
  448.    cntue();
  449.    waitkey();
  450.    sm(4);
  451.    backclr(1);
  452.  
  453.    printf("   The next screen will demonstrate\n\n");
  454.    printf("    T U R T L E  F U N C T I O N S");
  455.  
  456.    printf("\n\n\n\n\n   The delay function is used to");
  457.    printf("\n   slow down the display of lines\n");
  458.    cntue();
  459.    waitkey();
  460.    palette(0,5,8);
  461.  
  462.    pg5();
  463.    cntue();
  464.    waitkey();
  465.    sm(4);
  466.    backclr(1);
  467.  
  468.    script('P', 5, 100, 3);
  469.    script('a', 5, 116, 3);
  470.    script('l', 5, 132, 3);
  471.    script('e', 5, 148, 3);
  472.    script('t', 5, 164, 3);
  473.    script('t', 5, 180, 3);
  474.    script('e', 5, 196, 3);
  475.  
  476.    redalert();
  477.  
  478.    printf("\n\n\n\nThe following page illustrates\n");
  479.    printf("the palette command.  This command\n");
  480.    printf("allows the programmer to control the\n");
  481.    printf("color set and background color with\n");
  482.    printf("one command.  There are a total of 6\n");
  483.    printf("sets of three colors that may be \n");
  484.    printf("displayed.  Three of these are normal;\n");
  485.    printf("while the other three are bright\n");
  486.    printf("versions of the basic three.\n");
  487.    printf("\n\n     Press any key to continue\n");
  488.    waitkey();
  489.  
  490.    pg6();
  491.    cntue();
  492.    waitkey();
  493.    sm(4);
  494.    backclr(9);
  495.  
  496.  
  497.    pg7();
  498.    cntue();
  499.    waitkey();
  500.    sm(4);
  501.    backclr(9);
  502.  
  503.  
  504.    pg8();
  505.    atsay(24,7,3,0, "Press any key to continue");
  506.    waitkey();
  507.    sm(4);
  508.    backclr(9);
  509.  
  510.    pgf();
  511.    waitkey();
  512.    sm(3);
  513.    backclr(1);
  514.  
  515.  
  516.  
  517.    sm(3);
  518.    printf("\n\n\n\n");
  519.    printf("\tPlease address any comments, sugestions or criticisms to the\n");
  520.    printf("\tauthor - we do listen, many of the functions in the library\n");
  521.    printf("\tcurrently are a result of listening to users.  \n");
  522.    printf("\tThis Lirary is designed as a library for Turbo C from \n");
  523.    printf("\tBorland International.  A Microsoft C version 4.0 and 5.0\n");
  524.    printf("\tversion of the library are also available.  Other versions\n");
  525.    printf("\tare possible if there is enough interest in them.\n\n");
  526.    printf("\tAll currently registered owners of the Unicorn Library will be\n");
  527.    printf("\table to update for an update fee.  A preprinted manual will also\n");
  528.    printf("\tbe made available for those who so wish. Registered owners, as with\n");
  529.    printf("\tthe Unicorn Library will, of course, receive ALL source code for the\n");
  530.    printf("\tlibrary.\n\n");
  531.    printf("                             David A.  Miller\n");
  532.    printf("                             Unicorn Software\n");
  533.    printf("                             8018 NE 123rd St\n");
  534.    printf("                             Kirkland, WA 98034\n");
  535.    printf("                             (206) 823 4656 after 6:30PM \n");
  536.    printf("                             (no collect calls PLEASE)  \n");
  537.  
  538.  
  539.  
  540. }
  541.  
  542.  
  543. pg1()
  544. {
  545.    atsay(10,5,2,0, "The next page will demonstrate");
  546.    atsay(11,5,2,0, "some of the simple graphics");
  547.    atsay(12,5,2,0, "primitives including dots,");
  548.    atsay(13,5,2,0, "lines, filled boxes and");
  549.    atsay(14,5,2,0, "rectangles. ");
  550.    atsay(20,5,3,0, "Press any key to continue");
  551. }
  552.  
  553. pg2()
  554. {
  555.    int i;
  556.  
  557.    for(i=0; i <= 20; i++)
  558.       point(20, 10+i*2, i % 4);
  559.    rect(50,20,80,50,1);
  560.    boxfill(54,24,76,46,2);
  561.    rect1(50,80,80,110,2,1);
  562.    rect2(50,140,80,170,3,1);
  563.    circle(65,240,50,1,1,3);
  564.    paint(65,240,2,3);
  565.    line(120,20,190,300,1);
  566.    line(190,20,120,300,2);
  567.    line(155,20,155,300,3);
  568. }
  569.  
  570. pg3()
  571. {
  572.    atsay(7,5,3,0, "The following screen will further");
  573.    atsay(8,5,3,0, "demonstrate the circle function");
  574.    atsay(9,5,3,0, "and introduce the rotated ellipse");
  575.    atsay(10,5,3,0, "function.  The latter allows the");
  576.    atsay(11,5,3,0, "user to draw an ellipse with a");
  577.    atsay(12,5,3,0, "specified aspect and angle of");
  578.    atsay(13,5,3,0, "rotation.");
  579. }
  580.  
  581.  
  582. pg5()
  583. {
  584.  
  585.    turnright(150);     /*  Double Triangle  */
  586.  
  587.    pencolor(1);
  588.  
  589.    forward(50);
  590.  
  591.    delay(500);
  592.    turnright(120);
  593.    forward(50);
  594.    delay(500);
  595.    turnright(120);
  596.    forward(100);
  597.    delay(500);
  598.    turnleft(120);
  599.    forward(50);
  600.    delay(500);
  601.    turnleft(120);
  602.    forward(50);
  603.  
  604.    turnright(180);
  605.    forward(50);
  606.  
  607.    pencolor(0);
  608.  
  609.    forward(50);
  610.    turnright(120);
  611.    pencolor(2);
  612.    delay(500);
  613.    forward(100);
  614.    turnright(60);
  615.    delay(500);
  616.    forward(100);
  617.    turnright(60);
  618.    delay(500);
  619.    forward(100);
  620.    turnright(60);
  621.    delay(500);
  622.    forward(100);
  623.    turnright(60);
  624.    delay(500);
  625.    forward(100);
  626.    turnright(60);
  627.    delay(500);
  628.    forward(97);
  629.  
  630.    turnright(72);
  631.    forward(5);
  632.    pencolor(0);
  633.    forward(48);
  634.    turnright(96);
  635.  
  636.    turnleft(72);
  637.    pencolor(3);
  638.    forward(90);
  639.    turnright(72);
  640.    forward(90);
  641.    turnright(72);
  642.    forward(90);
  643.    turnright(72);
  644.    forward(90);
  645.    turnright(73);
  646.    forward(90);
  647.    pencolor(0);
  648.  
  649.    paint(90,160,3,1);
  650.    paint(110,160,3,1);
  651.  
  652.    paint(40,160,2,3);
  653.    paint(182,160,1,2);
  654.  
  655.  }
  656.  
  657.  
  658. pg6()
  659. {
  660.    palette(2,4,0);
  661.    house();
  662.    palette(0,5,0);
  663.    house();
  664.    palette(0,4,0);
  665.    house();
  666. }
  667.  
  668.  
  669. house()
  670. {
  671.    int i;
  672.  
  673.    for(i=0;i<=120;i++)                 /* Make some stars in the sky */
  674.       point(rand() / 165,rand() / 103, rand() / 8192);
  675.  
  676.    line(180,0,180,319,1);        /* grass line */
  677.    paint(183,10,1,1);            /*   grass */
  678.    line(150,50,120,110,1);
  679.    line(120,110,152,160,1);
  680.  
  681.    line(140,70,180,70,1);
  682.    line(140,140,180,140,1);
  683.    line(180,70,180,140,1);
  684.  
  685.    line(160,80,180,80,1);
  686.    line(160,95,180,95,1);
  687.    line(160,80,160,95,1);
  688.  
  689.  
  690.    line(150,110,170,110,1);       /* Window */
  691.    line(150,120,170,120,1);
  692.    line(150,130,170,130,1);
  693.    line(150,110,150,130,1);
  694.    line(160,110,160,130,1);
  695.    line(170,110,170,130,1);
  696.    paint(155,115,2,1);             /* color the widow panes */
  697.    paint(155,125,2,1);
  698.    paint(165,115,2,1);
  699.    paint(165,125,2,1);
  700.    paint(130,110,3,1);            /* color the house  */
  701.  
  702.    line(130,100,130,120,2);       /* lines in the house */
  703.    line(161,75,161,79,2);
  704.    line(155,86,155,97,2);
  705.    line(165,100,165,107,2);
  706.    line(161,72,161,78,2);
  707.    line(142,70,142,93,2);
  708.    line(147,100,147,116,2);
  709.  
  710.    paint(170,90,2,1);             /*  color the door   */
  711.    circle(170,90,2,1,1,1);        /*    knob           */
  712.    paint(170,90,2,1);             /*   fill it         */
  713.    line(114,124,128,124,2);       /*   chimney         */
  714.    line(114,136,136,136,2);
  715.    line(114,124,114,136,2);
  716.    line(128,124,136,136,2);
  717.    paint(120,130,2,2);            /*  fill chimney       */
  718.    line(116,125,116,135,3);       /*  horizontal bricks  */
  719.    line(118,125,118,135,3);
  720.    line(120,125,120,135,3);
  721.    line(122,125,122,135,3);
  722.    line(124,125,124,135,3);
  723.    line(126,125,126,135,3);
  724.    line(128,125,128,135,3);
  725.    line(130,128,130,135,3);
  726.    line(132,132,132,135,3);
  727.    line(134,134,134,135,3);
  728.  
  729.    line(116,130,118,130,3);       /*  vertical bricks */
  730.    line(118,133,120,133,3);
  731.    line(118,127,120,127,3);
  732.    line(120,130,122,130,3);
  733.    line(122,127,124,127,3);
  734.    line(122,133,124,133,3);
  735.    line(124,130,126,130,3);
  736.    line(126,127,128,127,3);
  737.    line(126,133,128,133,3);
  738.  
  739.    line(128,130,130,130,3);
  740.    line(130,133,132,133,3);
  741.  
  742.    line(132,130,134,130,3);
  743.  
  744.    boxfill(140,190,180,210,3);      /*  Tree Trunk   */
  745.    line(168,190,172,188,3);
  746.    line(172,188,180,177,3);
  747.    line(168,210,172,212,3);
  748.    line(172,212,180,223,3);
  749.    line(180,177,180,223,3);         /*  base line of tree  */
  750.    paint(178,185,3,3);              /*  paint the tree     */
  751.    paint(178,215,3,3);
  752.  
  753.    line(174,190,178,183,2);        /*   root lines in tree */
  754.    line(172,210,178,213,2);
  755.    line(174,198,178,190,2);
  756.    line(176,203,178,207,2);
  757.    circle(150,190,3,3,1,3);
  758.    paint(150,189,3,3);
  759.    circle(160,210,3,1,3,3);
  760.    paint(160,211,3,3);
  761.    point(168,205,2);
  762.    point(171,203,2);
  763.    point(168,193,2);
  764.    point(172,195,2);
  765.  
  766.    circle(135,216,10,1,2,1);
  767.    paint(135,216,1,1);
  768.    circle(105,180,9,1,1,1);
  769.    paint(105,180,1,1);
  770.    circle(128,180,9,1,3,1);
  771.    paint(128,180,1,1);
  772.    circle(125,228,5,1,2,1);
  773.    paint(125,228,1,1);
  774.    circle(94,200,10,1,3,1);
  775.    paint(94,200,1,1);
  776.  
  777.    circle(117,200,30,3,5,1);
  778.    paint(116,200,1,1);
  779.    line(110,190,117,200,3);
  780.    line(120,180,128,197,3);
  781.    line(115,200,125,180,3);
  782.  
  783.    circle(74,100,10,1,1,2);       /*   cloud  */
  784.    paint(74,100,2,2);
  785.    circle(62,130,12,1,2,2);
  786.    paint(62,130,2,2);
  787.    circle(72,70,9,1,2,2);
  788.    paint(72,70,2,2);
  789.    circle(32,58,8,1,2,2);
  790.    paint(32,58,2,2);
  791.    circle(20,68,22,1,2,2);
  792.    paint(20,68,2,2);
  793.    circle(35,130,12,1,2,2);
  794.    paint(35,130,2,2);
  795.    circle(21,95,10,1,2,2);
  796.    paint(21,95,2,2);
  797.    circle(33,125,7,1,2,2);
  798.    paint(33,125,2,2);
  799.  
  800.    circle(50,100,41,3,7,2);            /*   cloud  */
  801.    paint(50,100,2,2);               /*  fill it */
  802.  
  803.  
  804.    line(150,194,167,194,1);
  805.    line(142,197,153,197,1);
  806.    line(165,195,174,195,1);
  807.    line(147,200,153,200,1);
  808.    line(150,205,164,205,1);
  809.    line(153,201,164,201,1);
  810.    line(163,202,172,202,1);
  811.  
  812.  
  813.    circle(50,270,15,1,1,3);      /*  moon */
  814.    paint(50,270,03,03);            /*  fill it  */
  815.    point(52,273,1);
  816.    point(43,260,1);
  817.    point(52,262,1);
  818.    point(53,262,1);
  819.    point(52,261,1);
  820.    point(53,273,1);
  821.    point(40,270,1);
  822.    point(60,268,1);
  823.    point(45,281,1);
  824.    point(45,282,1);
  825.    point(44,281,1);
  826.    point(44,272,0);
  827.    point(43,272,0);
  828.    point(43,271,0);
  829.    point(47,265,0);
  830.    point(46,265,0);
  831.    point(46,264,0);
  832.    point(53,275,0);
  833.    point(54,276,0);
  834.  
  835.    delay(3000);
  836. }
  837.  
  838.  
  839. pg7()
  840. {
  841.  
  842.    rhollow(20, 100, 'F',0,  0,3, .15);
  843.    rhollow(20, 100, 'O',0, 22,3, .15);
  844.    rhollow(20, 100, 'N',0, 44,3, .15);
  845.    rhollow(20, 100, 'T',0, 66,3, .15);
  846.    rhollow(20, 100, 'S',0, 88,3, .15);
  847.  
  848.    gliss(100,1000,300);
  849.  
  850.    atsay(6,2,2,0,"  Many different Fonts are Possible");
  851.    atsay(7,2,3,0, "      Including rotated fonts");
  852.  
  853.    usrfont('T',80,60,2,2,3,0);
  854.    usrfont('H',80,80,2,2,3,0);
  855.    usrfont('I',80,100,2,2,3,0);
  856.    usrfont('N',80,120,2,2,3,0);
  857.    usrfont('L',88,140,1,1,3,0);
  858.    usrfont('E',88,150,1,1,3,0);
  859.    usrfont('T',88,160,1,1,3,0);
  860.    usrfont('T',88,170,1,1,3,0);
  861.    usrfont('E',88,180,1,1,3,0);
  862.    usrfont('R',88,190,1,1,3,0);
  863.    usrfont('S',88,200,1,1,3,0);
  864.  
  865.    usrfont('S',135,146,1,1,3,1);
  866.    usrfont('U',135,152,1,1,3,1);
  867.    usrfont('B',135,158,1,1,3,1);
  868.    usrfont('/',130,164,1,1,3,0);
  869.    usrfont('S',127,174,1,1,3,1);
  870.    usrfont('U',127,180,1,1,3,1);
  871.    usrfont('P',127,186,1,1,3,1);
  872.    usrfont('E',127,192,1,1,3,1);
  873.    usrfont('R',127,198,1,1,3,1);
  874.    usrfont('S',130,209,1,1,2,0);
  875.    usrfont('C',130,219,1,1,2,0);
  876.    usrfont('R',130,229,1,1,2,0);
  877.    usrfont('I',130,239,1,1,2,0);
  878.    usrfont('P',130,249,1,1,2,0);
  879.    usrfont('T',130,259,1,1,2,0);
  880.    usrfont('S',130,269,1,1,2,0);
  881.  
  882.  
  883.  
  884.    usrfont('X',175,65,3,3,1,0);
  885.    usrfont('2',175,97,2,2,1,1);
  886.    usrfont('+',175,105,3,3,1,0);
  887.    usrfont('X',175,134,3,3,1,0);
  888.    usrfont('-',175,160,3,3,1,0);
  889.    usrfont('4',175,185,3,3,1,0);
  890.    usrfont('=',175,210,3,3,1,0);
  891.    usrfont('0',175,230,3,3,1,0);
  892.  
  893. }
  894.  
  895.  
  896.  
  897. pg8()
  898. {
  899.    printf("   Below are a few Unit Conversions\n\n\n\n\n");
  900.    printf("%8.6f inches    = %f cm\n",4.0, INCH_CM(4.0));
  901.    printf("%8.6f cm       = %f inches\n",10.0, CM_INCH(10.0));
  902.    printf("%8.6f degrees  = %f radians\n",90.0, DEG_RAD(90.0));
  903.    printf("%8.6f radians   = %f degrees\n",1.0, RAD_DEG(1.0));
  904.    printf("%8.6f ounces    = %f grams\n",4.0, OZ_GM(4.0));
  905.    printf("%8.6f grams    = %f ounces\n",50.0, GM_OZ(50.0));
  906.    printf("%8.6f gallons  = %f liters\n",10.0, GAL_LT(10.0));
  907.    printf("%8.6f liters   = %f gallons\n",50.0, LT_GAL(50.0));
  908.    printf("%8.6f pounds    = %f kilograms\n",4.0, LB_KG(4.0));
  909.    printf("%8.6f kilogram = %f pounds\n",50.0, KG_LB(50.0));
  910.  
  911. }
  912.  
  913.  
  914.  
  915. pgf()
  916. {
  917.  
  918.  
  919.    rgothic(25, 15, 'U', 0,   0,  3, .2);
  920.    rgothic(25, 15, 'n', 0,  16,  3, .2);
  921.    rgothic(25, 15, 'i', 0,  32,  3, .2);
  922.    rgothic(25, 15, 'c', 0,  48,  3, .2);
  923.    rgothic(25, 15, 'o', 0,  64,  3, .2);
  924.    rgothic(25, 15, 'r', 0,  80,  3, .2);
  925.    rgothic(25, 15, 'n', 0,  96,  3, .2);
  926.  
  927.    rgothic(5, 155, 'S', 0,   0,  3, -.17);
  928.    rgothic(5, 155, 'o', 0,  18,  3, -.17);
  929.    rgothic(5, 155, 'f', 0,  32,  3, -.17);
  930.    rgothic(5, 155, 't', 0,  48,  3, -.17);
  931.    rgothic(5, 155, 'w', 0,  64,  3, -.17);
  932.    rgothic(5, 155, 'a', 0,  80,  3, -.17);
  933.    rgothic(5, 155, 'r', 0,  96,  3, -.17);
  934.    rgothic(5, 155, 'e', 0, 112,  3, -.17);
  935.  
  936.  
  937.    atsay(7,5,3,0, "We Hope you have enjoyed seeing");
  938.    atsay(8,5,3,0, "some of the features contained");
  939.    atsay(9,5,3,0, "in the C TOOL BOX for the");
  940.    atsay(10,5,3,0, "IBM PC medium resolution mode");
  941.    atsay(11,5,3,0, "graphics.  The next release");
  942.    atsay(12,5,3,0, "(Dec 87) will contain even");
  943.    atsay(13,5,3,0, "more features.  Currently");
  944.    atsay(14,5,3,0, "registered users will receive.");
  945.    atsay(15,5,3,0, "a FREE UPDATE when released.");
  946.  
  947.    atsay(17,5,2,0, "       Developed by");
  948.    atsay(18,5,2,0, "      David A. Miller");
  949.  
  950.    gliss(3000, 200, 100);
  951.  
  952.    atsay(24,4,2,0, " Press any key to return to Dos");
  953. }
  954.  
  955.  
  956.  
  957.  
  958. atom()
  959. {
  960.   ellipser(100,160,0,50,25,2);
  961.   ellipser(100,160,0,25,50,2);
  962.   ellipser(100,160,48,50,25,1);
  963.   ellipser(100,160,48,25,50,1);
  964.                
  965.   circle(100,160,70,1,1,1);
  966.   circle(100,160,66,1,1,1);
  967.   paint(100,228,2,1);
  968.   circle(100,160,4,1,1,3);
  969.   paint(100,160,3,3);
  970. }
  971.  
  972.  
  973. cntue()
  974. {
  975.    atsay(15,1,2,0, "Press any");
  976.    atsay(16,2,2,0, "Key to");
  977.    atsay(17,1,2,0, "continue");
  978. }
  979.  
  980. unicorn()
  981. {
  982.    line(66,100,107,156, 3);      /*   horn  */
  983.    line(66,100,113,148, 3);
  984.  
  985.  
  986.    line(157,170,158,154, 3);
  987.    line(158,154,172,138, 3);
  988.    line(172,138,173,125, 3);
  989.    line(173,125,166,115, 3);
  990.    line(166,115,151,117, 3);
  991.    line(151,117,130,138, 3);
  992.    line(130,138,120,140, 3);
  993.    line(120,140,98,168, 3);     /* this line ends at the ear  */
  994.    line(98,168,85,165,  3);
  995.    line(85,165,89,172, 3);
  996.    line(89,172,97,180, 3);
  997.    line(97,180,121,224, 3);     /* outline after ear      */
  998.    line(121,224,156,255, 3);
  999.    line(156,255,198,266, 3);    /*  very bottom line  */
  1000.  
  1001.    line(157,170,170,180, 3);     /* part to left going down  */
  1002.    line(170,180,198,180, 3);     /* very bottom line */
  1003.  
  1004.    line(198,180,198,266,3);      /*   line across base of head  */
  1005.    paint(188,182,3,3);           /*   fill in the head!!  */
  1006.    paint(111,148, 3,3);        /*   fill in the horn    */
  1007.    line(148,185,157,170, 2);      /* head starting at bottom  */
  1008.  
  1009.    line(152,130,140,142, 2);     /* in head near mouth    */
  1010.    line(140,142,133,156, 2);
  1011.  
  1012.    line(103,167,123,173,2);     /* between ear and eye   */
  1013.  
  1014.    line(173,125,160,138,2);       /*  mouth   */
  1015.  
  1016.    line(167,145,181,151,3);       /*  goatee   */
  1017.    line(181,151,175,141,3);
  1018.    line(175,141,183,139,3);
  1019.    line(183,139,173,133,3);
  1020.    paint(172,141,3,3);             /*  color the goatee  */
  1021.  
  1022.    line(102,149,107,142, 2);       /* lines across the horn   */
  1023.    line(97,140, 100,135, 2);
  1024.    line(91,134,94,130, 2);
  1025.    line(86,127,88,122, 2);
  1026.    line(81,121,83,119, 2);
  1027.    line(76,113,77,111, 2);
  1028.  
  1029.    line(98,180,140,182,2);        /*  mane     */
  1030.    line(106,160,118,168,2);
  1031.    line(140,182,149,198,2);
  1032.    line(130,205,170,208,2);
  1033.    line(170,208,180,220,2);
  1034.    line(154,232,190,235,2);
  1035.    line(190,235,194,245,2);
  1036.  
  1037.    ellipser(122,158,42,7,3,2);
  1038.    paint(122,158,2,2);
  1039.    ellipser(156,123,72,4,2,2);
  1040.    paint(156,123,2,2);
  1041.  
  1042.    circle(123,157,2,1,1,1);
  1043.    paint(123,157,1,1);
  1044.    point(123,157,3);
  1045.  
  1046. }
  1047.  
  1048.